import {RequestUtil} from '@/utils'

export class SystemHttp {
    static PREFIX = "/manager/system"
    // ====== 模块管理接口 ============
    static getModulePage = (params: Record<string, any>) => RequestUtil.getAjax(`${this.PREFIX}/module/pageList`, params)

    static addModule = (data: Record<string, any>) => RequestUtil.postAjax(`${this.PREFIX}/module/add`, data)

    static updateModule = (id: string | number, data: Record<string, any>) => RequestUtil.putAjax(`${this.PREFIX}/module/update/${id}`, data)

    static delModule = (data: any[]) => RequestUtil.delAjax(`${this.PREFIX}/module/delete`, data)

    // ====== 数据字典管理接口 ============
    static getDictPage = (params: Record<string, any>) => RequestUtil.getAjax(`${this.PREFIX}/dict/pageList`, params)

    static addDict = (data: Record<string, any>) => RequestUtil.postAjax(`${this.PREFIX}/dict/add`, data)

    static updateDict = (id: string | number, data: Record<string, any>) => RequestUtil.putAjax(`${this.PREFIX}/dict/update/${id}`, data)

    static delDict = (data: any[]) => RequestUtil.delAjax(`${this.PREFIX}/dict/delete`, data)

    static downLoadDict = () => RequestUtil.postAjax(`${this.PREFIX}/dict/download`)

    // ====== API管理接口 ============
    static getApiPage = (params: Record<string, any>) => RequestUtil.getAjax(`${this.PREFIX}/api/pageList`, params)

    static addApi = (data: Record<string, any>) => RequestUtil.postAjax(`${this.PREFIX}/api/add`, data)

    static updateApi = (id: string | number, data: Record<string, any>) => RequestUtil.putAjax(`${this.PREFIX}/api/update/${id}`, data)

    static delApi = (data: any[]) => RequestUtil.delAjax(`${this.PREFIX}/api/delete`, data)

    static downLoadApi = () => RequestUtil.postAjax(`${this.PREFIX}/api/download`)

    static scanApi = () => RequestUtil.postAjax(`${this.PREFIX}/api/scan`)

    // ====== 菜单管理 ============
    static getMenuList = () => RequestUtil.getAjax(`${this.PREFIX}/menu/list`)

    static addMenu = (data: Record<string, any>) => RequestUtil.postAjax(`${this.PREFIX}/menu/add`, data)

    static updateMenu = (id: string | number, data: Record<string, any>) => RequestUtil.putAjax(`${this.PREFIX}/menu/update/${id}`, data)

    static delMenu = (data: any[]) => RequestUtil.delAjax(`${this.PREFIX}/menu/delete`, data)

    // ====== 配置管理 ============
    static getConfigPage = (params: Record<string, any>) => RequestUtil.getAjax(`${this.PREFIX}/config/pageList`, params)

    static addConfig = (data: Record<string, any>) => RequestUtil.postAjax(`${this.PREFIX}/config/add`, data)

    static updateConfig = (id: string | number, data: Record<string, any>) => RequestUtil.putAjax(`${this.PREFIX}/config/update/${id}`, data)

    static delConfig = (data: any[]) => RequestUtil.delAjax(`${this.PREFIX}/config/delete`, data)

    static refreshConfig = (data: any[]) => RequestUtil.postAjax(`${this.PREFIX}/config/refresh`, data)

}
